package knapsackga;

import java.util.Comparator;


public interface FitnessFunction
{
    public double calculateFitness( int[] alleles );

    public class FitnessComparator implements Comparator<Genome>
    {
        @Override
        public int compare( Genome o1, Genome o2 )
        {
            int c = 0;

            if( o1.getFitness() > o2.getFitness() )
            {
                c = -1;
            }
            else if( o1.getFitness() < o2.getFitness() )
            {
                c = 1;
            }

            return c;
        }
    }
}
